package com.zhangwei.expands;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.base.lib.utils.SuperToastUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

public class ToolBarActivity extends AppCompatActivity {

    @Bind(R.id.toolbar)
    Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tool_bar);
        ButterKnife.bind(this);
        initToolBar();
    }

    private void initToolBar() {
        toolbar.setLogo(R.mipmap.ic_feed_favourite_normal);
        toolbar.setTitleTextColor(getResources().getColor(R.color.dark_background));
        toolbar.setTitle("ToolBar");
        toolbar.setSubtitle("RecyclerView");
        setSupportActionBar(toolbar);
        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                switch (item.getItemId()) {
                    case R.id.menu_toolbar:
                        SuperToastUtils.showShort("menu_toolbar");
                        break;
                }
                return true;
            }
        });

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_toolbar, menu);
        return true;
    }

}
